package com.km.team.phsystem.common.enums;

import java.util.ArrayList;
import java.util.List;

/**
 * Author: jiangjun
 * Date: 2018/9/18
 * Time: 下午4:55
 * Description: 排号状态
 */
public enum QueueStatusEnum {

    QUEUE_STATUS_RESERVED("1", "已预约"),
    QUEUE_STATUS_MSG_SENDED("2", "短信已发送"),
    QUEUE_STATUS_DISPATCHED("3", "已分配"),
    QUEUE_STATUS_PROCESS_START("4", "开始服务"),
    QUEUE_STATUS_PROCESS_COMPLETE("5", "服务完成"),
    QUEUE_STATUS_SKIP("6", "跳过"),
    QUEUE_STATUS_TIMEOUT("7", "超时"),
    QUEUE_STATUS_USER_CANCEL("8", "用户取消"),
    QUEUE_STATUS_TERMINATE("9", "终止"),
    ;


    /**
     * 类型
     */
    private String type;

    /**
     * 名称
     */
    private String name;

    QueueStatusEnum(String type, String name) {
        this.type = type;
        this.name = name;
    }

    /**
     * 根据类型获取状态名称
     * @param type
     * @return
     */
    public static String getNameByType(String type){
        for(QueueStatusEnum item : QueueStatusEnum.values()){
            if(item.getType().equals(type)){
                return item.getName();
            }
        }
        return null;
    }

    /**
     * 开始业务处理状态集合。该集合中的状态不允许再进行业务重置
     * @return
     */
    public static List<String> startProcessList(){
        List<String> list = new ArrayList<>();
        list.add(QueueStatusEnum.QUEUE_STATUS_PROCESS_START.getType());
        list.add(QueueStatusEnum.QUEUE_STATUS_PROCESS_COMPLETE.getType());
        list.add(QueueStatusEnum.QUEUE_STATUS_TIMEOUT.getType());
        list.add(QueueStatusEnum.QUEUE_STATUS_USER_CANCEL.getType());
        list.add(QueueStatusEnum.QUEUE_STATUS_TERMINATE.getType());
        return list;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
